<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>定单数据分析</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" >
    <script th:src="@{/layui/layui.js}" charset="utf-8"></script>
    <script th:src="@{/echarts/echarts.common.min.js}" charset="utf-8"></script>
</head>
<body>
定单数据分析
<div id="container" style="width:100%;height: 400px"></div>
<script type="text/javascript">
    layui.use('layer',function () {
        var $ = layui.jquery;

        var dom = document.getElementById("container");
        var myChart = echarts.init(dom);
        var app = {};
        option = null;

        //request
        var m_dates =new Array();
        var m_incomes =new Array();
        var m_total =new Array();
        $.get("/dataanalysis/monthincomes", function(resp){
            for(var i=0;i<resp.length;i++){
                //console.log(resp[i].my_date);
                m_dates[i] = resp[i].my_date;
                m_incomes[i] = resp[i].my_income;
                m_total[i] = resp[i].my_total;
            }

            option = {
                xAxis: {
                    type: 'category',
                    data: m_dates
                },
                yAxis: {
                    type: 'value'
                },
                series: [{
                    name:'月收入',
                    data: m_incomes,
                    barWidth:20,
                    type: 'bar'
                }]
            };

            if (option && typeof option === "object") {
                myChart.setOption(option, true);
            }
        });

    });


</script>
</body>
</html>
